<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="lib/layui-v2.4.5/layui/css/layui.css">
    <script src="lib/jquery-3.3.1.min/jquery-3.3.1.min.js"></script>
    <script src="lib/layer-v3.1.1/layer/layer.js"></script>
    <script src="lib/layui-v2.4.5/layui/layui.js"></script>
</head>
<body>
<button type="button" class="layui-btn" id="test1">
    <i class="layui-icon">&#xe67c;</i>上传Excel
</button>
</body>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: 'http://localhost:8080/import' //上传接口
            ,accept:'file'
            ,done: function(res){
                //上传完毕回调
                layer.msg('上传成功');
            }
            ,error: function(err){
                //请求异常回调
                layer.msg('请求异常');
            }
        });
    });
</script>
</html>